package com.bbex.mapper;

import com.bbex.entity.PpMoveConf;
import com.bbex.sql.build.PpMoveConfBuild;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface PpMoveConfDao {

    @InsertProvider(type = PpMoveConfBuild.class, method = "insert")
    void insert(PpMoveConf moveConf);

    @Select("SELECT " + PpMoveConfBuild.columns + " FROM pp_move_conf t WHERE t.status = '1' ORDER BY t.lock_day ASC ")
    List<PpMoveConf> findAll();

    @Select("SELECT " + PpMoveConfBuild.columns + " FROM pp_move_conf t WHERE t.status = '1' AND t.transfer_status = '1' AND t.coin_symbol = #{coinSymbol} ORDER BY t.lock_day ASC ")
    List<PpMoveConf> findByCoinSymbol(@Param("coinSymbol") String coinSymbol);

    @Select("SELECT MIN(t.min_in_volume) FROM pp_move_conf t WHERE t.status = '1'")
    BigDecimal getMinInVol();

    @Select("SELECT MIN(t.min_out_volume) FROM pp_move_conf t WHERE t.status = '1'")
    BigDecimal getMinOutVol();
}
